package chapter11;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.File;

/**
 * Created with IntelliJ IDEA.
 * Description:
 *
 * @author lzy
 * @create 2018-03-22 下午2:31
 */
public class DirectoryTest {
    private static final Logger LOGGER = LoggerFactory.getLogger(DirectoryTest.class);

    public static void main(String[] args) {
        File file = new File(File.separator + "home" + File.separator + "lzy" + File.separator);

        print(file);

//        if (file.isDirectory()) {
//            File[] result = file.listFiles();
//            for (File f : result) {
//                LOGGER.info(f.toString());
//            }
//        }
    }

    private static void print(File file) {
        if (file.isDirectory()) {
            File[] result = file.listFiles();
            if (result != null) {
                for (File f : result) {
                    print(f);
                }
            }
        }
        LOGGER.info(file.toString());
    }
}
